package com.example.mapstruct.simple_map;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

// @Mapper标注映射类，通过Mappers.getMapper获取实例
@Mapper
public interface CarMapper {
    CarMapper INSTANCE = Mappers.getMapper(CarMapper.class);

    // @Mapping标注属性名称不一致时的映射关系，如下表示将 Car.age -> CarDTO.useAge
    @Mapping(source = "age", target = "useAge")
    CarDTO carToCarDTO(Car car);
}
